package com.localservice.local;


import com.localservice.service.NormalBusiness;
import com.localservice.service.MessageService;
import com.localservice.service.StockService;
import com.localservice.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 类说明：本地方法调用的实现
 */
@Service
public class LocalCall {

    @Autowired
    private NormalBusiness normalBusiness;
    @Autowired
    private StockService stockService;
    @Autowired
    private MessageService messageService;

    public void processOrder() {

        long start = System.currentTimeMillis();
        normalBusiness.business();

        /*扣减库存*/
        stockService.deduceStock("B002", 50);

        /*发送邮件*/
        messageService.sendMail(new UserInfo("Mark", "Mark@xiangxue.com"));

        System.out.println("共耗时：" + (System.currentTimeMillis() - start) + "ms");
    }

}
